<?php

class LoginForm extends sfGuardFormSignin
{
  public function configure()
  {
    $this->setWidgets(array(
      'username' => new sfWidgetFormInput(),
      'password' => new sfWidgetFormInput(array('type' => 'password')),
      'category' => new sfWidgetFormChoice(array(
	      'choices'  => SupercategoryPeer::getAll(),
      	      'multiple' => false,
              'expanded' => false
      )),
    ));

    $this->setValidators(array(
      'username' => new sfValidatorString(),
      'password' => new sfValidatorString(),
      'category' => new sfValidatorChoice(array(
      		'choices'	=> array_keys(SupercategoryPeer::getAll())
      )),
    ));

    $this->validatorSchema->setPostValidator(new sfGuardValidatorUser());

    $this->widgetSchema->setNameFormat('signin[%s]');
  }
}
